/**
 * Implementacion de la clase Edge.
 */

#include "edge.hpp"


Edge::Edge(std::string id, std::string originId, std::string destinyId, Weight weight){
	this->id = id;
	this->originId = originId;
	this->destinyId = destinyId;
	this->weight = weight;

	this->roadSide = AMBOS;

	this->belongToMP = false;
}

Edge::Edge(std::string id, std::string originId, std::string destinyId, Weight weight, int initialHeight, int finalHeight, std::string roadName, RoadType roadType) 
{
	this->id = id;
	this->originId = originId;
	this->destinyId = destinyId;
	this->weight = weight;
    this->initialHeight = initialHeight;
    this->finalHeight = finalHeight;
    this->roadName = roadName;
    this->roadType = roadType;

	this->roadSide = AMBOS;

	this->belongToMP = false;

}

std::string Edge::getId(){
	return this->id;
}

std::string Edge::getOriginId(){
	return this->originId;
}

std::string Edge::getDestinyId(){
	return this->destinyId;
}

RoadType Edge::getRoadType(){
    return this->roadType;
}

RoadSide Edge::getRoadSide(){
    return this->roadSide;
}

std::string Edge::getRoadName(){
    return this->roadName;
}

int Edge::getInitialHeight(){
    return this->initialHeight;
}

int Edge::getFinalHeight(){
    return this->finalHeight;
}

Weight Edge::getWeight(){
	return this->weight;
}

void Edge::setId(std::string id){
	this->id = id;
}

void Edge::setOrigin(std::string origin){
	this->originId = origin;
}

void Edge::setDestiny(std::string destiny){
	this->destinyId = destiny;
}

void Edge::setWeight(Weight weight){
	this->weight = weight;
}

void Edge::setRoadType(RoadType roadType){
    this->roadType = roadType;
}


void Edge::setRoadSide(RoadSide roadSide){
    this->roadSide = roadSide;
}

void Edge::setRoadName(std::string roadName){
    this->roadName = roadName;
}

void Edge::setInitialHeight(int initialHeight){
    this->initialHeight = initialHeight;
}

void Edge::setFinalHeight(int finalHeight){
    this->finalHeight = finalHeight;
}

Edge& Edge::operator=(Edge &original){
	this->id = original.getId();
	this->originId = original.getOriginId();
	this->destinyId = original.getDestinyId();
	this->weight.setLength(original.getWeight().getLength());
	this->weight.setVelocity(original.getWeight().getVelocity());
    this->initialHeight = original.getInitialHeight();
    this->finalHeight = original.getFinalHeight();
    this->roadName = original.getRoadName();
    this->roadType = original.getRoadType();
	return *this;
}

int Edge::operator==(Edge &original) const{
    return (this->id == original.getId());
}

int Edge::operator!=(Edge &original) const{
    return (this->id != original.getId());
}

int Edge::operator<(Edge &original) const{
    return (this->id < original.getId());
}

int Edge::operator>(Edge &original) const{
    return (this->id > original.getId());
}

int Edge::operator<=(Edge &original) const{
    return (this->id <= original.getId());
}

int Edge::operator>=(Edge &original) const{
    return (this->id >= original.getId());
}



bool Edge::getBelongToMP()
{
	return this->belongToMP;
}


void Edge::setBelongToMP()
{
	this->belongToMP=true;
	this->initialMPHeight= this->initialHeight;
	this->finalMPHeight = this->finalHeight;
}


void Edge::setBelongToMP(int initialMPHeight , int finalMPHeight)
{
	this->belongToMP=true;
	this->initialMPHeight= initialMPHeight;
	this->finalMPHeight = finalMPHeight;	
}

void Edge::cleanMPInfo()
{
	this->belongToMP=false;
	this->initialMPHeight = NULL;
	this->finalMPHeight = NULL;
}

int Edge::getInitialMPHeight()
{
	return this->initialMPHeight;
}
int Edge::getFinalMPHeight()
{
	return this->finalMPHeight;
}

Edge::~Edge(){
    //has to do nothing
}

